import Tkinter

class DesignerImpl(Tkinter.Frame):
    def __init__(self, parent, stylesheets = None):
        Tkinter.Frame.__init__(self, parent)
        self.pack(expand = Tkinter.YES, fill = Tkinter.BOTH)

        self.stylesheets = stylesheets
        self.menuFrame   = None
        self.prepareFrameContent()

    def prepareFrameContent(self):
        self.menuFrame = Tkinter.Menu(self, tearoff = 0)
        self.menuFrame.add_command(label = "create horizontal pane", \
                                   command = self.createHorizontalPane)
        self.menuFrame.add_command(label = "create vertical pane", \
                                   command = self.createVerticalPane)

        self.bind("<Button-3>", self.showFrameMenu)

    def showFrameMenu(self, event):
        self.menuFrame.post(event.x_root, event.y_root)

    def createHorizontalPane(self):
        pane = Tkinter.PanedWindow(self, orient = Tkinter.VERTICAL)
        pane["showhandle"] = True
        pane.pack(expand = Tkinter.YES, fill = Tkinter.BOTH)

        designer1 = DesignerImpl(pane)
        designer1.pack(expand = Tkinter.YES, side = Tkinter.TOP)
        pane.add(designer1)

        designer2 = DesignerImpl(pane)
        designer2.pack(expand = Tkinter.YES, side = Tkinter.TOP)
        pane.add(designer2)

    def createVerticalPane(self):
        pane = Tkinter.PanedWindow(self, orient = Tkinter.HORIZONTAL)
        pane["showhandle"] = True
        pane.pack(expand = Tkinter.YES, fill = Tkinter.BOTH)

        designer1 = DesignerImpl(pane)
        designer1.pack(expand = Tkinter.YES, side = Tkinter.TOP)
        pane.add(designer1)

        designer2 = DesignerImpl(pane)
        designer2.pack(expand = Tkinter.YES, side = Tkinter.TOP)
        pane.add(designer2)

if __name__ == "__main__":
    root = Tkinter.Tk()
    root.title("PyXmlTkinter Designer")
    root.geometry('600x400+100+100')

    designer = DesignerImpl(root)
    designer.mainloop()

